using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

namespace WinTestBinding
{
    [Serializable]
    public class Personne : INotifyPropertyChanged
    {
        public Personne() { }
        public Personne(string nom, int age)
        {
            this.Nom = nom;
            this.Age = age;
        }

        private string m_Nom = string.Empty;
        private int m_Age;

        public string Nom
        {
            get { return m_Nom; }
            set 
            {
                if (value != m_Nom)
                {
                    m_Nom = value;
                    OnPropertyChanged(new PropertyChangedEventArgs("Nom"));
                }
            }
        }

        public int Age
        {
            get { return m_Age; }
            set 
            {
                if (m_Age != value)
                {
                    m_Age = value;
                    OnPropertyChanged(new PropertyChangedEventArgs("Age"));
                }
            }
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(PropertyChangedEventArgs e)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, e);
        }
        #endregion
    }
}
